<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>练习1</title>
  <script src="../js/jquery-3.7.1.min.js"></script>
  <script type="text/javascript">
    $(function () {
      var $p = $("p");
      $p.each(function () {
        $(this).click(function () {
          alert($(this).text());
        })
      })
      $("p").click(function () {
        alert($(this).text())
      })
    })
  </script>
</head>
<body>
<p>段落1</p>
<p>段落2</p>
<p>段落3</p>
</body>
</html>
